using UnityEditor;
using UnityEditor.UI;
using UnityEngine;
using UnityX;

namespace UnityXEditor
{
    [CanEditMultipleObjects]
    [CustomEditor(typeof(ImageSectorGradientColor), true)]
    internal class ImageSectorGradientColorEditor : GraphicEditor
    {
        private SerializedProperty m_Texture;
        private SerializedProperty m_VertCount;
        private SerializedProperty m_BeginAngle;
        private SerializedProperty m_EndAngle;

        private SerializedProperty m_BeginColor;
        private SerializedProperty m_EndColor;
        private SerializedProperty m_CenterColor;

        protected override void OnEnable()
        {
            base.OnEnable();
            m_Texture = serializedObject.FindProperty("m_Texture");
            m_VertCount = serializedObject.FindProperty("m_VertCount");
            m_BeginAngle = serializedObject.FindProperty("m_BeginAngle");
            m_EndAngle = serializedObject.FindProperty("m_EndAngle");

            m_BeginColor = serializedObject.FindProperty("m_BeginColor");
            m_EndColor = serializedObject.FindProperty("m_EndColor");
            m_CenterColor = serializedObject.FindProperty("m_CenterColor");
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.PropertyField(m_Texture);
            AppearanceControlsGUI();
            RaycastControlsGUI();
            MaskableControlsGUI();

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_BeginAngle, new GUIContent("开始角度"));
            EditorGUILayout.PropertyField(m_EndAngle, new GUIContent("结束角度"));
            EditorGUILayout.PropertyField(m_VertCount, new GUIContent("顶点数量"));

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_BeginColor, new GUIContent("开始颜色"));
            EditorGUILayout.PropertyField(m_EndColor, new GUIContent("结束颜色"));
            EditorGUILayout.PropertyField(m_CenterColor, new GUIContent("中心颜色"));

            serializedObject.ApplyModifiedProperties();
        }
    }
}